package com.shuai;

/**
 * @author shuaihong-coding
 * @date 2025/10/3
 * @className DCLSingleton
 *     <p>懒汉式单例 双重检查锁
 */
@SuppressWarnings("all")
public class LayLoadSingletonDCL {

  /** 实例申明 */
  private static LayLoadSingletonDCL singleton;

  /** 私有化构造器，避免外部创建实例 */
  private LayLoadSingletonDCL() {}

  /**
   * 获取实例
   *
   * @return
   */
  public static LayLoadSingletonDCL getSingleton() {
    if (singleton == null) {
      synchronized (LayLoadSingletonDCL.class) {
        if (singleton == null) {
          singleton = new LayLoadSingletonDCL();
        }
      }
    }
    return singleton;
  }
}
